import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TaskWorkflowConfigRefVO, TaskWorkflowConfigRefForm, TaskWorkflowConfigRefQuery } from '@/api/config/taskWorkflowConfigRef/types';

/**
 * 查询任务工作流配置关联列表
 * @param query
 * @returns {*}
 */

export const listTaskWorkflowConfigRef = (query?: TaskWorkflowConfigRefQuery): AxiosPromise<TaskWorkflowConfigRefVO[]> => {
  return request({
    url: '/config/taskWorkflowConfigRef/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询任务工作流配置关联详细
 * @param id
 */
export const getTaskWorkflowConfigRef = (id: string | number): AxiosPromise<TaskWorkflowConfigRefVO> => {
  return request({
    url: '/config/taskWorkflowConfigRef/' + id,
    method: 'get'
  });
};

/**
 * 新增任务工作流配置关联
 * @param data
 */
export const addTaskWorkflowConfigRef = (data: TaskWorkflowConfigRefForm) => {
  return request({
    url: '/config/taskWorkflowConfigRef',
    method: 'post',
    data: data
  });
};

/**
 * 修改任务工作流配置关联
 * @param data
 */
export const updateTaskWorkflowConfigRef = (data: TaskWorkflowConfigRefForm) => {
  return request({
    url: '/config/taskWorkflowConfigRef',
    method: 'put',
    data: data
  });
};

/**
 * 删除任务工作流配置关联
 * @param id
 */
export const delTaskWorkflowConfigRef = (id: string | number | Array<string | number>) => {
  return request({
    url: '/config/taskWorkflowConfigRef/' + id,
    method: 'delete'
  });
};
